﻿using System.Collections.Specialized;
using System.Xml;
using SqlMapper.SqlElements;

namespace SqlMapper.Serializers
{
    public sealed class IsNotNullDeSerializer : IDeSerializer
    {
        public BaseTag Deserialize(XmlNode node)
        {
            IsNotNull isNotNull = new IsNotNull();

            NameValueCollection prop = NodeUtils.ParseAttributes(node);
            isNotNull.Prepend = NodeUtils.GetStringAttribute(prop, "prepend");
            isNotNull.Property = NodeUtils.GetStringAttribute(prop, "property");
            isNotNull.Sql = NodeUtils.GetStringAttribute(prop, "sql");

            return isNotNull;
        }
    }
}
